{"ast":null,"code":"import classNames from 'classnames';\nimport { SubMenu as RcSubMenu, useFullPath } from 'rc-menu';\nimport omit from \"rc-util/es/omit\";\nimport * as React from 'react';\nimport { cloneElement, isValidElement } from '../_util/reactNode';\nimport MenuContext from './MenuContext';\nconst SubMenu = props => {\n  var _a;\n  const {\n    popupClassName,\n    icon,\n    title,\n    theme: customTheme\n  } = props;\n  const context = React.useContext(MenuContext);\n  const {\n    prefixCls,\n    inlineCollapsed,\n    theme: contextTheme,\n    mode\n  } = context;\n  const parentPath = useFullPath();\n  let titleNode;\n  if (!icon) {\n    titleNode = inlineCollapsed && !parentPath.length && title && typeof title === 'string' ? /*#__PURE__*/React.createElement(\"div\", {\n      className: `${prefixCls}-inline-collapsed-noicon`\n    }, title.charAt(0)) : /*#__PURE__*/React.createElement(\"span\", {\n      className: `${prefixCls}-title-content`\n    }, title);\n  } else {\n    // inline-collapsed.md demo 依赖 span 来隐藏文字,有 icon 属性，则内部包裹一个 span\n    // ref: https://github.com/ant-design/ant-design/pull/23456\n    const titleIsSpan = isValidElement(title) && title.type === 'span';\n    titleNode = /*#__PURE__*/React.createElement(React.Fragment, null, cloneElement(icon, {\n      className: classNames(isValidElement(icon) ? (_a = icon.props) === null || _a === void 0 ? void 0 : _a.className : '', `${prefixCls}-item-icon`)\n    }), titleIsSpan ? title : /*#__PURE__*/React.createElement(\"span\", {\n      className: `${prefixCls}-title-content`\n    }, title));\n  }\n  const contextValue = React.useMemo(() => Object.assign(Object.assign({}, context), {\n    firstLevel: false\n  }), [context]);\n  const popupOffset = mode === 'horizontal' ? [0, 8] : [10, 0];\n  return /*#__PURE__*/React.createElement(MenuContext.Provider, {\n    value: contextValue\n  }, /*#__PURE__*/React.createElement(RcSubMenu, Object.assign({\n    popupOffset: popupOffset\n  }, omit(props, ['icon']), {\n    title: titleNode,\n    popupClassName: classNames(prefixCls, popupClassName, `${prefixCls}-${customTheme || contextTheme}`)\n  })));\n};\nexport default SubMenu;","map":{"version":3,"names":["classNames","SubMenu","RcSubMenu","useFullPath","omit","React","cloneElement","isValidElement","MenuContext","props","_a","popupClassName","icon","title","theme","customTheme","context","useContext","prefixCls","inlineCollapsed","contextTheme","mode","parentPath","titleNode","length","createElement","className","charAt","titleIsSpan","type","Fragment","contextValue","useMemo","Object","assign","firstLevel","popupOffset","Provider","value"],"sources":["/data/messenger.client/node_modules/antd/es/menu/SubMenu.js"],"sourcesContent":["import classNames from 'classnames';\nimport { SubMenu as RcSubMenu, useFullPath } from 'rc-menu';\nimport omit from \"rc-util/es/omit\";\nimport * as React from 'react';\nimport { cloneElement, isValidElement } from '../_util/reactNode';\nimport MenuContext from './MenuContext';\nconst SubMenu = props => {\n  var _a;\n  const {\n    popupClassName,\n    icon,\n    title,\n    theme: customTheme\n  } = props;\n  const context = React.useContext(MenuContext);\n  const {\n    prefixCls,\n    inlineCollapsed,\n    theme: contextTheme,\n    mode\n  } = context;\n  const parentPath = useFullPath();\n  let titleNode;\n  if (!icon) {\n    titleNode = inlineCollapsed && !parentPath.length && title && typeof title === 'string' ? /*#__PURE__*/React.createElement(\"div\", {\n      className: `${prefixCls}-inline-collapsed-noicon`\n    }, title.charAt(0)) : /*#__PURE__*/React.createElement(\"span\", {\n      className: `${prefixCls}-title-content`\n    }, title);\n  } else {\n    // inline-collapsed.md demo 依赖 span 来隐藏文字,有 icon 属性，则内部包裹一个 span\n    // ref: https://github.com/ant-design/ant-design/pull/23456\n    const titleIsSpan = isValidElement(title) && title.type === 'span';\n    titleNode = /*#__PURE__*/React.createElement(React.Fragment, null, cloneElement(icon, {\n      className: classNames(isValidElement(icon) ? (_a = icon.props) === null || _a === void 0 ? void 0 : _a.className : '', `${prefixCls}-item-icon`)\n    }), titleIsSpan ? title : /*#__PURE__*/React.createElement(\"span\", {\n      className: `${prefixCls}-title-content`\n    }, title));\n  }\n  const contextValue = React.useMemo(() => Object.assign(Object.assign({}, context), {\n    firstLevel: false\n  }), [context]);\n  const popupOffset = mode === 'horizontal' ? [0, 8] : [10, 0];\n  return /*#__PURE__*/React.createElement(MenuContext.Provider, {\n    value: contextValue\n  }, /*#__PURE__*/React.createElement(RcSubMenu, Object.assign({\n    popupOffset: popupOffset\n  }, omit(props, ['icon']), {\n    title: titleNode,\n    popupClassName: classNames(prefixCls, popupClassName, `${prefixCls}-${customTheme || contextTheme}`)\n  })));\n};\nexport default SubMenu;"],"mappings":"AAAA,OAAOA,UAAU,MAAM,YAAY;AACnC,SAASC,OAAO,IAAIC,SAAS,EAAEC,WAAW,QAAQ,SAAS;AAC3D,OAAOC,IAAI,MAAM,iBAAiB;AAClC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,YAAY,EAAEC,cAAc,QAAQ,oBAAoB;AACjE,OAAOC,WAAW,MAAM,eAAe;AACvC,MAAMP,OAAO,GAAGQ,KAAK,IAAI;EACvB,IAAIC,EAAE;EACN,MAAM;IACJC,cAAc;IACdC,IAAI;IACJC,KAAK;IACLC,KAAK,EAAEC;EACT,CAAC,GAAGN,KAAK;EACT,MAAMO,OAAO,GAAGX,KAAK,CAACY,UAAU,CAACT,WAAW,CAAC;EAC7C,MAAM;IACJU,SAAS;IACTC,eAAe;IACfL,KAAK,EAAEM,YAAY;IACnBC;EACF,CAAC,GAAGL,OAAO;EACX,MAAMM,UAAU,GAAGnB,WAAW,EAAE;EAChC,IAAIoB,SAAS;EACb,IAAI,CAACX,IAAI,EAAE;IACTW,SAAS,GAAGJ,eAAe,IAAI,CAACG,UAAU,CAACE,MAAM,IAAIX,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,GAAG,aAAaR,KAAK,CAACoB,aAAa,CAAC,KAAK,EAAE;MAChIC,SAAS,EAAG,GAAER,SAAU;IAC1B,CAAC,EAAEL,KAAK,CAACc,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,aAAatB,KAAK,CAACoB,aAAa,CAAC,MAAM,EAAE;MAC7DC,SAAS,EAAG,GAAER,SAAU;IAC1B,CAAC,EAAEL,KAAK,CAAC;EACX,C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